﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Mathematics
{
    public sealed class Constant : MathExpression
    {
        public Constant(double value)
        {
            Value = value;
        }

        public double Value { get; private set; }

        public override string ToString()
        {
            return Value.ToString();
        }


        public override double? Evaluate()
        {
            return Value;
        }

        public override bool CanEvaluate()
        {
            return true;
        }

        //public override IEnumerable<Variable> GetVariables()
        //{
        //    return new Variable[0];
        //}

        //public override IEnumerable<Constant> GetConstants()
        //{
        //    yield return this;
        //}

        protected internal override MathExpression Reduce(out bool didReduce)
        {
            didReduce = false;
            return this;
        }

        
    }
}
